<?php

//header('Content-Type: text/xml');
//function flickrRss() {
    $flickr = "http://api.flickr.com/services/rest/?method=flickr.photos.search";
    $api_key = "api_key=8eb50e0f19955b2dffb98d076d5a5cb8";
    $user_id = "user_id=" . urlencode("72548870@N00");
    $url = $flickr . "&" . $api_key . "&" . $user_id;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);


    $simple_xml = simplexml_load_string($result);
    $photos = $simple_xml->xpath("//photo[@id]");

    $fbArr = array(); // array for fancybox
    foreach ($photos as $photo) {
        $photo_url = "http://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . ".jpg";
        $photo_title = strval($photo['title']);

        $photo_info = array(
            'href' => $photo_url,
            'title' => $photo_title
        );
        array_push($fbArr, $photo_info);
//    echo $photo_url . "<br>";
    }
//    print_r($fbArr[1]);
//    echo $fbArr;
    echo json_encode($fbArr);
//}
?>

